<template>
    <div>
        <Row class-name="row">
            <Col span="5">
                <label style="font-weight: bold">来源平台：</label>
            </Col>
            <Col span="12">
                <Select v-model="platformId" clearable filterable placeholder="选择来源平台" style="width:200px">
                    <Option v-for="item in list" :value="item.Key" :key="item.Key">{{ item.Value }}</Option>
                </Select>
            </Col>
        </Row>
    </div>
</template>

<script>

    import {createNamespacedHelpers} from 'vuex';

    const {mapActions, mapMutations} = createNamespacedHelpers('commondata');

    export default {
        name: 'PlatformSelect',
        components: {},
        props: {
            value: ''
        },
        data() {
            return {
                platformId: '',
            };
        },
        methods: {
            ...mapActions([
                'handleStoreQueryPlatforms'
            ]),
        },
        computed: {
            list() {
                return this.$store.state.commondata.Platforms;
            }
        },
        watch: {
            value(newValue, oldValue) {
                this.platformId = newValue;
            },
            platformId() {
                this.$emit('input', this.platformId);
            }
        },
        mounted() {
            this.handleStoreQueryPlatforms();
        }
    };
</script>

<style scoped>
    .row {
        line-height: 28px;
        height: 28px;
    }
</style>
